/************************************************************
 * Copyright (C), 2022-2030, ripnano. Co., Ltd.
 * FileName:        my_tabbar_style.h
 * Author:          Dan Yin
 * Date:            2023-04-18
 * Description:     the class of tabbar for custom controls
 * Version:         1.0.0.0
 **********************************************************/

#ifndef MY_TABBAR_STYLE_H
#define MY_TABBAR_STYLE_H

#include <QProxyStyle>
#include <QPainter>
#include <QStyleOptionTab>

class MyTabBarStyle : public QProxyStyle
{
    Q_OBJECT
public:
    MyTabBarStyle(Qt::Orientation orientation = Qt::Vertical);

    ~MyTabBarStyle();

    // Draws the given element with the provided painter with the style options specified by option.
    void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;

    // Draws the given text in the specified rectangle using the provided painter and palette.
    void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;

    // Returns the size of the element described by the specified option and type, based on the provided contentsSize.
    QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const;

private:
    Qt::Orientation m_oriHV;
};

#endif // MY_TABBAR_STYLE_H
